/*
 */
package nl.hanze.FlitsNieuws.network;

import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;

/**
 * Klasse die wordt gebruikt om het resultaat van een netwerkaanroep af te handelen
 * 
 * @author alex
 */
public class NetworkResultReceiver extends ResultReceiver {   
    public static final int RESULT_OK = 200;
    public static final int RESULT_UNAUTHORIZED = 403;
    public static final int RESULT_DOES_NOT_EXIST = 404;
    public static final int RESULT_ERROR = 0;
    
    private NetworkCallbackReceiver mNetworkCallBackReceiver;

    public NetworkResultReceiver() {
        super(new Handler());
    }

    public void setNetworkCallBackReceiver(NetworkCallbackReceiver mNetworkCallBackReceiver) {
        this.mNetworkCallBackReceiver = mNetworkCallBackReceiver;
    }

    @Override
    protected void onReceiveResult(int resultCode, Bundle resultData) {
        if (mNetworkCallBackReceiver != null) {
            mNetworkCallBackReceiver.onNetworkCallback(resultCode, resultData);
        }
    }
}
